package com.markhsiu.tools;

import java.io.*;
import java.util.List;

/**
 * @author Mark Hsiu
 * @since 2018/8/2 上午1:50
 */
public class FileUtils {

    public static BufferedReader readLines(String filePath) throws FileNotFoundException {
        return new BufferedReader(new FileReader(new File(filePath)));
    }

    public static void writeLines(String filePath, List<String> result) throws Exception{
        // write string to file
        FileWriter writer = new FileWriter(filePath);
        BufferedWriter bw = new BufferedWriter(writer);
        for(int i = 0 ;i<result.size();i++){
            bw.write(result.get(i));
            bw.newLine();
        }
        bw.close();
        writer.close();
    }


}
